#include "core/image.hpp"

Image::Image(const int W, const int H) : w(W), h(H)
{
  buffer = new Color[w*h];
  buffer_uchar = new unsigned char[w*h*3];
}

Image::~Image()
{
  delete[] buffer;
  delete[] buffer_uchar;
}

void Image::updateUchar()
{
  for(int x=0; x<w; x++)
    {
      for(int y=0; y<h; y++)
	{
	  for(int c=0; c<3; c++)
	    {
	      buffer_uchar[(x*h+y)*3+c] = int(255*buffer[x*h+y][c]);
	    }
	}
    }
}
